var express = require('express');
var router = express.Router();
var router2 = require('../routehandles/mysqlhandle');
/* GET home page. */
router.get('/', function(req, res, next) {
  console.log("来到了get")
  res.append('Access-Control-Allow-Origin', "*")
  next()
});

router.post('/iuap', function(req, res) {
  var params = req.body
  router2.iUAPTable(params.username,params.password,params.nickname,params.picurl);
});
router.post('/duap', function(req, res) {
  var params = req.body
  router2.dPushTable(params.username);
});
router.post('/uuap', function(req, res) {
  var params = req.body
  router2.uUAPTable(params.key,params.value,params.username);
});
router.post('/suap', async function(req, res) {
  var params = req.body
  var xx = await router2.sUAPTable(params.username)
  console.log(xx[0]['nickname'])
});
router.post('/suapu', async function(req, res) {
  var params = req.body
  console.log(await router2.sUAPTableUsername());
});

module.exports = router;
